package com.xkh.demo3;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @author xkh
 * 2021/6/29
 */
@SpringBootApplication
@EnableSwagger2
@EnableCaching
@Slf4j
public class Demo3Application {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext application = SpringApplication.run(Demo3Application.class, args);
        Environment env = application.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        log.info("\n\t启动成功:\n\t" +
                "访问链接: \thttp://" + ip + ":" + port +
                "\n\t文档地址: \thttp://" + ip + ":" + port + "/doc.html" +
                "\n\t----------------------------------------------------------");
        log.info("========================分库分表DEMO启动完毕========================");
    }
}
